package com.house.schdule;

import com.house.enums.LeaseStatus;
import com.house.service.LeaseAgreementService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * ClassName:SchduleTasks
 * package:com.house.schdule
 * Description:
 *
 * @Author lfz
 * @create: 2024/12/1512:40
 * version: 1.0
 */
@Component
public class SchduleTasks {
//  ┌───────────── second (0-59)
//  │ ┌───────────── minute (0 - 59)
//  │ │ ┌───────────── hour (0 - 23)
//  │ │ │ ┌───────────── day of the month (1 - 31)
//  │ │ │ │ ┌───────────── month (1 - 12) (or JAN-DEC)
//  │ │ │ │ │ ┌───────────── day of the week (0 - 7)
//  │ │ │ │ │ │          (0 or 7 is Sunday, or MON-SUN)
//  │ │ │ │ │ │
//  * * * * * *
    @Autowired
    private LeaseAgreementService leaseAgreementService;
    @Scheduled(cron = "0 0 0 * * *")
    public void checkLeaseStatus(){
        leaseAgreementService.updateStatus(LeaseStatus.EXPIRED);
    }
}
